package org.greatstorm.dao.impl;

import java.util.List;

import org.greatstorm.dao.CategoryDao;
import org.greatstorm.dao.GeneralDao;
import org.greatstorm.entity.Category;
import org.greatstorm.entity.EntityObject;
import org.greatstorm.util.Filter;
import org.greatstorm.util.Operator;

import com.google.inject.Singleton;

@Singleton
public class CategoryDaoImpl extends GeneralDao implements CategoryDao {

	@Override
	protected String getEntityName() {
		return Category.KIND;
	}

	@Override
	public EntityObject getCategoryByName(String name) {
		Filter f1 = new Filter();
		f1.setKey(Category.CATEGORY_NAME);
		f1.setOpt(Operator.OPT_EQUAL);
		f1.setValue(name);

		EntityObject ret = this.getUniqueEntity(f1);

		return ret;
	}

	@Override
	public List<EntityObject> getAll() {
		return this.getAll(1, Integer.MAX_VALUE);
	}
}
